<?php
@session_start();
$PurviewLevel=2;
$CheckChannelID=0;  
$PurviewLevel_Others="yingxiao_vpp_link";

require("../../inc/common.inc.php");
require_once("../Admin_ChkPurview.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<TITLE>铭讯EOS网站后台管理</TITLE>
<Meta name="Keywords" Content="济南网站建设 济南网站制作 山东网站建设 济南铭讯软件有限公司">
<Meta name="Description" Content="济南网站制作：铭讯软件专业服务优秀企业，致力于网站建、设网站推广、网络营销一体的全访位网络服务商">
<link rel="stylesheet" href="../images/style.css" type="text/css">
</head>
<body>
<?php
if($actions=="list")
{
//更新选中信息排列顺序
	foreach( $listdb AS $key=>$value){
		$db->excu("UPDATE mx_vpp_link_type SET orderid='$value' WHERE id='$key'");
	}
	jump2("修改成功","$FROMURL",1);
	exit();
}
elseif($actions=="saveadd")
{
	if($type_name==""){
		$fun->popmassage("分类名称不能为空","","popback");
		exit();
	}
	$classid=intval($classid);
	if ($orderid==""){$orderid=666;}
	$fields=array(
		"type_name"     =>$type_name,
		"type_pic"      =>$type_pic,
		"orderid"       =>$orderid,
		"classid"       =>$classid,
		"adddate"       =>date("Y-m-d H:i:s"),
		"addid"         =>$_SESSION['mxadmin']['userid'],
	);
	$db->exe_insert("mx_vpp_link_type",$fields);	
	jump2("添加成功","yx_vpp_linktype.php");
	exit();
}
elseif ($actions=="savemodi"){
	$id=intval($id);
	if($id==""){
		$fun->popmassage("请选择要修改的信息","","popback");
		exit();
	}
	if($type_name==""){
		$fun->popmassage("分类名称不能为空","","popback");
		exit();
	}
	  
	$classid=intval($classid);
	if ($orderid==""){$orderid=666;}
	$fields=array(
		"type_name"     =>$type_name,
		"type_pic"      =>$type_pic,
		"orderid"       =>$orderid,
		"classid"       =>$classid,
		"modidate"      =>date("Y-m-d H:i:s"),
		"modiid"        =>$_SESSION['mxadmin']['userid'],
	);
	$db->exe_update("mx_vpp_link_type",$fields,"id='$id'");	
	if (trim($gotourl)==""){
		$gotourl=$FROMURL;
	}else{$gotourl=url_code($gotourl);}
	jump2("修改成功","$gotourl",1);
	exit();
}
elseif($actions=="del"){
	$id=intval($id);
	if($id==0){
		$fun->popmassage("请选择要删除的信息","","popback");
		exit();
	}
	$db->excu("DELETE FROM mx_vpp_link_type WHERE id='$id' ");
	$url=$fromurl?$fromurl:$FROMURL;
	jump2("操作成功",$url,1);
	exit();
}

?>
<?php require("../mx_head.php");?>
<div class="right">
<?php if ($actions=="add"){?>
<div class="xm2">
<h1 class="fl">添加分类</h1>
</div>
<div class="xm2_b">
<div class="height10"></div>
<table width='100%' cellspacing='1' cellpadding='5' class="table_southidc">
  <form name="form1" method="post" action="yx_vpp_linktype.php?actions=saveadd" onSubmit="return check();">
    <tr class="list"> 
      <td width="20%">分类名称：</td>
      <td width="80%"> 
        <input type='text' name='type_name' id="type_name" value='' size="60">      </td>
    </tr>
    <tr class="list"> 
      <td>分类排序：</td>
      <td colspan="2"> 
      <input class=mmcinb type='text' name='orderid' id="orderid" value='666' size='20'  onpropertychange="replaceNotNumber(this)" oninput="replaceNotNumber(this)">
      </td>
    </tr>
	<tr class="list">
      <td width='19%'></td>
      <td> 
        <input class="button" type='submit' name='Submit' value='提交数据'>      </td>
    </tr>
  </form>
</table>
<div class="height10"></div>
</div>
<?php 
}
elseif ($actions=="modi"){
//修改链接
  $query="SELECT * FROM mx_vpp_link_type where id='$id' limit 1";
  $result=$db->excu($query);
  if ($db->num_rows($result)<=0){
	$fun->popmassage("请选择要修改的链接","","popback");
	exit();
  }
  $rsdb=$db->fetch_array($result);
  if ($gotourl==""){$gotourl=url_encode($_SERVER['HTTP_REFERER']);}
?>
<div class="xm2">
<h1 class="fl">修改分类</h1>
</div>
<div class="xm2_b">
<div class="height10"></div>
<table width='100%' cellspacing='1' cellpadding='5' class="table_southidc">
  <form name="form1" method="post" action="yx_vpp_linktype.php" onSubmit="return  check();">
    <tr class="list"> 
      <td width="20%">分类名称：</td>
      <td width="80%"><input type='text' name='type_name' id="type_name" value='<?php echo $rsdb["type_name"]?>' size="60"></td>
    </tr>
    <tr class="list"> 
      <td>分类排序：</td>
      <td colspan="2"> 
      <input class=mmcinb type='text' name='orderid' id="orderid" value='<?php echo $rsdb["orderid"]?>' size='20'  onpropertychange="replaceNotNumber(this)" oninput="replaceNotNumber(this)">
      </td>
    </tr>
    <tr class="list"> 
      <td width='19%'> 
        <div align='right'></div>      </td>
      <td colspan="2"> 
        <input class="button" type='submit' name='Submit' value='提交数据'>
		<input type="hidden" name="id" value="<?php echo $rsdb[id] ?>">
		<input type="hidden" name="gotourl" value="<?php echo $gotourl?>">
		<input type="hidden" name="actions" value="savemodi">      </td>
    </tr>
  </form>
</table>
<div class="height10"></div>
</div>
<?php 
}
else{
?>
<div class="xm2">
<h1 class="fl">友情链接分类</h1>
</div>
<div class="xm2_b" style="border-bottom:0px;">
<div class="t">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
	<td>
	<div class="an1"><a href="yx_vpp_linktype.php">所有分类</a></div>
	<div class="an2"><a href="yx_vpp_linktype.php?actions=add">添加分类</a></div>
	</td>
	</tr>
	</table>
</div>
</div>
<div class="xm2_b">
<div class="height10"></div>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="table_southidc">
  <tr>
    <th height="30" align="center">分类名称</th>
    <th  width="20%" height="30" align="center">操作</th>
  </tr>
  <?php
   $sql="select * from mx_vpp_link_type where classid=0 order by orderid, id";
   $rlt=mysql_query($sql);
   while($rst=mysql_fetch_array($rlt))
   {
  ?>
        <tr class="list">
          <td height="29">&nbsp;<?php echo $rst['type_name'];?></td>
          <td align="center"><a href="?actions=modi&id=<?php echo $rst['id'];?>" class="a01">编辑</a>&nbsp;&nbsp;<a href="?actions=del&id=<?php echo $rst['id'];?>" class="a01">删除</a></td>
        </tr>
  <?php
  }
  ?>
</table>
<div class="clear"></div>
<div class="height10"></div>
<script type="text/javascript" src="/mxsoft/js/jquerys-1.5.1.js"></script>
<script language="javascript">
$(document).ready(function(){  
	$(".table_southidc tr").mouseover(function(){   
	$(this).addClass("list2");}).mouseout(function(){   
	$(this).removeClass("list2");}) //移除该行的class   
	$(".table_southidc tr:even").addClass("list1");   
});   
</script> 
<?php }?>
</div>
<script>
function check(){
	if (!CheckLength("type_name","分类名称")){
		return false;
	}
	if (!CheckLength("orderid","分类排序")){
		return false;
	}
	if (!CheckNum("orderid","分类排序")){
		return false;
	}
}
</script>
<?php
require("../mx_foot.php");
?>
<div class="clear"></div>
<div class="height10"></div>
</body>
</html>


